package com.efuture.chaptertow

/* @Description:Kt语言lambda表达式学习
 * @Auther: zhaoshanshan
 * @Date: 2022/03/04/6:53 下午
 */
fun main() {

    //匿名函数=lambda表达式
    val methodAction1 = {number1:Int,number2:Int->
        "两数相加的和为${number1+number2}"
    }
    println(methodAction1(1,1));

    //该匿名函数返回值类型是any
    val weekResultMethod = {week:Int->
        when(week){
            1->"星期一"
            2->"星期二"
            3->"星期三"
            4->"星期四"
            5->"星期五"
            6->"星期六"
            7->"星期天"
            else->-1

        }
    }
    println(weekResultMethod(1));
}